<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class welcome_controller extends PZ_Controller {
	public function __construct() {
		parent::__construct();
	}
	public function index(){
		$this->load_seo('home');
		$settingapi = load_api('setting');
		$welcomeapi = load_api('welcome');
		$this->slides = $settingapi->getSetting('homeslide');
		$layoutsetting = $settingapi->getSetting('layouthome');
		if($layoutsetting['uihome_ads']){
			$setting = load_api('setting')->getSetting('ads');
			$this->ads = $setting['homepage_ad'];
		}
		
		if($layoutsetting['uihome_album']){
			$this->albums = load_api('album')->getHotestAlbum($layoutsetting['uihome_album_num'],$layoutsetting['uihome_album_sharenum']);
		}
		if($layoutsetting['uihome_category']){
			$this->categories = load_api('category')->getCategoryWithHomeShares();
		}
		
		if($layoutsetting['uihome_user']){
			$users = $welcomeapi->getHotestUser($layoutsetting['uihome_user_num']);
			foreach ($users as $key=>$user){
				$users[$key]['relation_view'] = $this->relationView($this->cuser['uid'], $user['user_id']);
			}
			$this->hotusers = $users;
		}
		$this->shares = $welcomeapi->getLastest20($layoutsetting['uihome_hotshare_cachetime']);
		$this->output("welcome/index");
	}
	
}
